import socket

socket = socket.socket()
socket.bind(("127.0.0.1", 8888))
socket.listen(1)
conc, address = socket.accept()
print(f"接受到客户端连接，连接来自{address}")
while True:
    data = conc.recv(1024).decode("utf-8")
    if data == "exit":
        break
    if not data:
        break
    print("接受到发来的数据", data)
    reply = input("请输入回复消息").encode("utf-8")
    conc.send(reply)
conc.close()
socket.close()
print("程序开始正常退出了")
